package Model::Presence_for_bot;

use strict;
use utf8;
use Model::Presence;
our @ISA=qw( Model::Presence );
use Encode;

sub after_load {
	my $self= shift;
	Encode::_utf8_on( $self->{$_} ) foreach @{ $self->fields };
	$self;
}

my %db_qcount=();

sub log {
	$_[1]=~/^\w+/;
	$db_qcount{lc $&}++;
	#print $_[1] . "\n";
}

sub db_count { \%db_qcount }
sub before_delete {
	my $self=shift;
	my $jid = $self->get('jid');
	length($jid) or return;
	$self->query('UPDATE `presence_config` SET `changed`=NOW() WHERE `jid`=' . $self->quote($jid));
}

1;
